import random


class Person(object):
    @staticmethod
    def showPerson():
        lis = ['石头', '剪刀', '布']
        index = random.randint(0, 2)
        return lis[index]


class Computer(object):
    @classmethod
    def showComputer(cls):
        lis = ['石头', '剪刀', '布']
        index = random.randint(0, 2)
        return lis[index]


class Game(object):
    person = Person()
    computer = Computer()

    @classmethod
    def startGame(cls):
        per_score = 0  # 代表人的计分
        computer_score = 0  # 代表电脑计分
        count = 0  # 统计比赛次数
        while count < 5:
            user_show = cls.person.showPerson()
            computer_show = cls.computer.showComputer()
            print("第{}次人和电脑为：".format(count + 1), user_show, computer_show)
            if user_show == '石头' and computer_show == '剪刀':
                # print(user_show, user_show)
                per_score += 1
            elif user_show == '石头' and computer_show == '布':
                computer_score += 1
            elif user_show == '剪刀' and computer_show == '布':
                # print(user_show, computer_show)
                per_score += 1
            elif user_show == '剪刀' and computer_show == '石头':
                computer_score += 1
            elif user_show == '布' and computer_show == '石头':
                # print(user_show, computer_show)
                per_score += 1
            elif user_show == '布' and computer_show == '剪刀':
                computer_score += 1
            else:
                pass
                # print("打平")
            count += 1

        if per_score > computer_score:
            print("人的分数为：", per_score, "电脑的分数为：", computer_score)
            print("人赢了")
        elif per_score < computer_score:
            print("人的分数为：", per_score, "电脑的分数为：", computer_score)
            print("电脑赢了")
        else:
            print("人的分数为：", per_score, "电脑的分数为：", computer_score)
            print("双发打平了")


if __name__ == '__main__':
    Game.startGame()

'''

for _ in range(10):
    print(Person.showPerson())  # 概率 30%左右
    print(Computer.showComputer())

'''
